<!DOCTYPE html>
<html class="writer-html4" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>p4utils.utils.topology module &mdash; P4-Utils 1.0 documentation</title><link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
      <script>
          var DOCUMENTATION_OPTIONS = {
              URL_ROOT:'./',
              VERSION:'1.0',
              LANGUAGE:'None',
              COLLAPSE_INDEX:false,
              FILE_SUFFIX:'.html',
              HAS_SOURCE:  false,
              SOURCELINK_SUFFIX: '.txt'
          };
      </script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="p4utils.utils.traffic_utils module" href="p4utils.utils.traffic_utils.html" />
    <link rel="prev" title="p4utils.utils.thrift_API module" href="p4utils.utils.thrift_API.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="index.html" class="icon icon-home"> P4-Utils
          </a>
              <div class="version">
                1.0
              </div>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption"><span class="caption-text">General Documentation</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="usage.html">Usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced_usage.html">Advanced Usage</a></li>
</ul>
<p class="caption"><span class="caption-text">API Reference</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="p4utils.html">P4-Utils API reference</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="p4utils.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="p4utils.mininetlib.html">p4utils.mininetlib package</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="p4utils.utils.html">p4utils.utils package</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="p4utils.utils.html#subpackages">Subpackages</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="p4utils.utils.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="p4utils.utils.html#module-p4utils.utils">Module contents</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="p4utils.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="p4utils.html#module-p4utils">Module contents</a></li>
</ul>
</li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">P4-Utils</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
          <li><a href="p4utils.html">P4-Utils API reference</a> &raquo;</li>
          <li><a href="p4utils.utils.html">p4utils.utils package</a> &raquo;</li>
      <li>p4utils.utils.topology module</li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/nsg-ethz/p4-utils/blob/master/docs/source/p4utils.utils.topology.rst" class="fa fa-github"> Edit on GitHub</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <div class="section" id="module-p4utils.utils.topology">
<span id="p4utils-utils-topology-module"></span><h1>p4utils.utils.topology module<a class="headerlink" href="#module-p4utils.utils.topology" title="Permalink to this headline">¶</a></h1>
<p>This module includes all the features needed to query the <code class="docutils literal"><span class="pre">topology.json</span></code> file
generated by <em>P4-Utils</em> upon execution. Indeed, it allows the usage of topology
information in the controller code, so that the switches can be configured properly.</p>
<p>The topology file can be imported in a Python script by using the utility
<a class="reference internal" href="p4utils.utils.helper.html#p4utils.utils.helper.load_topo" title="p4utils.utils.helper.load_topo"><code class="xref py py-func docutils literal"><span class="pre">load_topo()</span></code></a>, as shown in the following example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">p4utils.utils.helper</span> <span class="kn">import</span> <span class="n">load_topo</span>

<span class="n">topo</span> <span class="o">=</span> <span class="n">load_topo</span><span class="p">(</span><span class="s1">&#39;topology.json&#39;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="exception">
<dt id="p4utils.utils.topology.IntfDoesNotExist">
<em class="property">exception </em><code class="descclassname">p4utils.utils.topology.</code><code class="descname">IntfDoesNotExist</code><span class="sig-paren">(</span><em>arg1</em>, <em>arg2</em>, <em>mode=0</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L35-L60"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.IntfDoesNotExist" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">Exception</span></code></a></p>
<p>Exception raised when an interface is not found.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>arg1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – first argument</li>
<li><strong>arg2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – second argument</li>
<li><strong>mode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><em>int</em></a>) – working mode</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Possible <strong>mode</strong> values are the following:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">0</span></code>, then <strong>arg1</strong> is the name of the missing interface and
<strong>arg2</strong> is the name of the node to which the interface belongs.</li>
<li><code class="docutils literal"><span class="pre">1</span></code>, then <strong>arg1</strong> is the name of the node to which the interface
belongs and <strong>arg2</strong> is the name of the node that the interface
is facing.</li>
</ul>
</dd></dl>

<dl class="exception">
<dt id="p4utils.utils.topology.InvalidHostIP">
<em class="property">exception </em><code class="descclassname">p4utils.utils.topology.</code><code class="descname">InvalidHostIP</code><span class="sig-paren">(</span><em>ip</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L16-L23"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.InvalidHostIP" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">Exception</span></code></a></p>
<p>Exception raised when a wrong host IP is provided.</p>
</dd></dl>

<dl class="class">
<dt id="p4utils.utils.topology.NetworkGraph">
<em class="property">class </em><code class="descclassname">p4utils.utils.topology.</code><code class="descname">NetworkGraph</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L62-L1276"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://networkx.org/documentation/stable/reference/classes/graph.html#networkx.Graph" title="(in NetworkX v2.6.2)"><code class="xref py py-class docutils literal"><span class="pre">networkx.classes.graph.Graph</span></code></a></p>
<p>Querying API that allows retrieving information about the
network topology. It also provides useful methods to perform
graph computation (e.g. Dijkstra’s algorithm to get shortest paths).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">To use this class in your Python code, you need to import the network
topology JSON file (automatically generated by any execution of <em>P4-Utils</em>).
This can be easily done with the function <a class="reference internal" href="p4utils.utils.helper.html#p4utils.utils.helper.load_topo" title="p4utils.utils.helper.load_topo"><code class="xref py py-func docutils literal"><span class="pre">load_topo()</span></code></a>.</p>
</div>
<dl class="attribute">
<dt id="p4utils.utils.topology.NetworkGraph.edge_to_intf">
<code class="descname">edge_to_intf</code><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.edge_to_intf" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a> – stores interface information indexed by <code class="docutils literal"><span class="pre">[node1][node2]</span></code>,
where the interface belongs to <code class="docutils literal"><span class="pre">node1</span></code> and
is facing <code class="docutils literal"><span class="pre">node2</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="p4utils.utils.topology.NetworkGraph.node_to_intf">
<code class="descname">node_to_intf</code><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_to_intf" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a> – stores interface information indexed by <code class="docutils literal"><span class="pre">[node][intfName]</span></code>,
where the interface belongs to <code class="docutils literal"><span class="pre">node</span></code> and
is named according to <code class="docutils literal"><span class="pre">intfName</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="p4utils.utils.topology.NetworkGraph.ip_to_host">
<code class="descname">ip_to_host</code><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.ip_to_host" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a> – stores hosts information indexed by <code class="docutils literal"><span class="pre">[ip]</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.are_neighbors">
<code class="descname">are_neighbors</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L982-L995"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.are_neighbors" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if two nodes are direct neighbors.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>True</strong> if the node are neighbors,
<strong>False</strong> otherwise.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.checkIntf">
<code class="descname">checkIntf</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L541-L552"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.checkIntf" title="Permalink to this definition">¶</a></dt>
<dd><p>Sanity check on interface existence.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#p4utils.utils.topology.IntfDoesNotExist" title="p4utils.utils.topology.IntfDoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">IntfDoesNotExist</span></code></a> – if the given interface does not exist.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.checkNode">
<code class="descname">checkNode</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L513-L523"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.checkNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Sanity check on node existence.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#p4utils.utils.topology.NodeDoesNotExist" title="p4utils.utils.topology.NodeDoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">NodeDoesNotExist</span></code></a> – if the given node does not exist.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_all_paths_between_nodes">
<code class="descname">get_all_paths_between_nodes</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1188-L1207"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_all_paths_between_nodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute all the simple paths (i.e. with no repeated nodes)
between <em>node1</em> and <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> – name of the starting node</li>
<li><strong>node2</strong> – name of the ending node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list of paths.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Each path is given as a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></a> of node names from the first to the
last one.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_cpu_port_index">
<code class="descname">get_cpu_port_index</code><span class="sig-paren">(</span><em>name</em>, <em>quiet=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L784-L801"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_cpu_port_index" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4 switch’s CPU port number, used for CPU packets.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4 switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">port number of the P4 switch’s CPU interface.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Returns <strong>None</strong> if no CPU port is found.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_cpu_port_intf">
<code class="descname">get_cpu_port_intf</code><span class="sig-paren">(</span><em>name</em>, <em>quiet=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L765-L782"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_cpu_port_intf" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4 switch’s CPU interface, used for CPU packets.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4 switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">name of the P4 switch’s CPU interface.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Returns <strong>None</strong> if no CPU port is found.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_ctl_cpu_intf">
<code class="descname">get_ctl_cpu_intf</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L865-L877"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_ctl_cpu_intf" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the controller side CPU interface, used to listen for CPU packets.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4 switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">name of the controller side CPU interface.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_direct_host_networks_from_switch">
<code class="descname">get_direct_host_networks_from_switch</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1049-L1063"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_direct_host_networks_from_switch" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all the subnetworks a switch can reach directly.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – switch name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#set" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">set</span></code></a> of subnetworks.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_grpc_ip">
<code class="descname">get_grpc_ip</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L848-L863"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_grpc_ip" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4Runtime switch’s IP where it listens for
incoming gRPC connections.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4Runtime switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">IP to connect to.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_grpc_port">
<code class="descname">get_grpc_port</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L834-L846"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_grpc_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4Runtime switch’s gRPC port number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4Runtime switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">gRPC port to connect to.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_host_first_interface">
<code class="descname">get_host_first_interface</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L897-L909"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_host_first_interface" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the first interface of a host.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – host name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">interface name.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_host_gateway_name">
<code class="descname">get_host_gateway_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L911-L927"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_host_gateway_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets host’s gateway.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – host name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">gateway node name.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This method assumes that the gateway is connected to the
host via its first interface.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_host_ip">
<code class="descname">get_host_ip</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L929-L949"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_host_ip" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets host’s IP address.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – host name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">host’s IP address.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This method assumes that hosts are single-homed (i.e.
with only one interface).</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_host_mac">
<code class="descname">get_host_mac</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L951-L966"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_host_mac" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets host’s MAC address.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – host name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">host’s MAC address.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This method assumes that hosts are single-homed (i.e.
with only one interface).</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_host_name">
<code class="descname">get_host_name</code><span class="sig-paren">(</span><em>ip</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L879-L895"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_host_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the host name from an IP address.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>ip</strong> – host IP without prefix length</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">name of the host whose IP corresponds to the one provided.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#p4utils.utils.topology.InvalidHostIP" title="p4utils.utils.topology.InvalidHostIP"><code class="xref py py-exc docutils literal"><span class="pre">InvalidHostIP</span></code></a> – if the IP provided does not match any host.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_hosts">
<code class="descname">get_hosts</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L401-L443"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_hosts" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the hosts and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the hosts configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by host name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_hosts</span><span class="p">())</span>
<span class="go">{&#39;h1&#39;:{&#39;isHost&#39;: True, &#39;isSwitch&#39;: False, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_hosts</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isSwitch&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: (True, False), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_hosts</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: True, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_hosts_connected_to">
<code class="descname">get_hosts_connected_to</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L997-L1008"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_hosts_connected_to" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets hosts directly connected to a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of hosts names.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_interfaces">
<code class="descname">get_interfaces</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L753-L763"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_interfaces" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the interfaces of a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of interfaces names.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_interfaces_to_node">
<code class="descname">get_interfaces_to_node</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1065-L1080"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_interfaces_to_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets dictionary that associates every node’s interface to its
connected neighbor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dictionary of node’s neighbors indexed by the corresponding
node’s interfaces.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_intfs">
<code class="descname">get_intfs</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L136-L179"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_intfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the interfaces and their configuration parameters using
the <em>nodes</em> as indexes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">the attribute <code class="docutils literal"><span class="pre">edge_to_intf</span></code> if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or a dictionary of
dictionaries of tuples, where the first two dictionaries are indexed by node and
the tuples contain the values of the specified interface configuration parameters
in the exact order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the inner dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_intfs</span><span class="p">())</span>
<span class="go">{&#39;h1&#39;: {&#39;s2&#39;: {&#39;port&#39;: 0, &#39;port_neigh&#39;: 1, ...}, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_intfs</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;port&#39;</span><span class="p">,</span> <span class="s1">&#39;port_neigh&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: {&#39;s2&#39;: (0, 1), ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_intfs</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;port&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: {&#39;s2&#39;: 0, ...}, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_neighbors">
<code class="descname">get_neighbors</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L489-L499"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_neighbors" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the neighbors of a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of neighbors names.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_node_intfs">
<code class="descname">get_node_intfs</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L181-L224"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_node_intfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the interfaces and their configuration parameters using <em>node</em>
and <em>interface name</em> as indexes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">the attribute <code class="docutils literal"><span class="pre">node_to_intf</span></code> if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or a dictionary of
dictionaries of tuples, where the first  dictionary is indexed by node, the second
one by interface name and the tuples contain the values of the specified interface
configuration parameters in the exact order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the inner dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_node_intfs</span><span class="p">())</span>
<span class="go">{&#39;h1&#39;: {&#39;h1-eth0&#39;:{&#39;port&#39;: 0, &#39;port_neigh&#39;: 1, ...}, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_node_intfs</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;port&#39;</span><span class="p">,</span> <span class="s1">&#39;port_neigh&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: {&#39;h1-eth0&#39;: (0, 1), ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_node_intfs</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;port&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: {&#39;h1-eth0&#39;: 0, ...}, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_nodes">
<code class="descname">get_nodes</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L226-L267"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_nodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the nodes and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the nodes configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by node name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_nodes</span><span class="p">())</span>
<span class="go">{&#39;h1&#39;:{&#39;isHost&#39;: True, &#39;isSwitch&#39;: False, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_nodes</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isSwitch&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: (True, False), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_nodes</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;h1&#39;: True, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_p4rtswitches">
<code class="descname">get_p4rtswitches</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L357-L399"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_p4rtswitches" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the P4Runtime switches and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the switches configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by switch name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4rtswitches</span><span class="p">())</span>
<span class="go">{&#39;s1&#39;:{&#39;isHost&#39;: False, &#39;isSwitch&#39;: True, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4rtswitches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isSwitch&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: (False, True), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4rtswitches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: False, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_p4switch_id">
<code class="descname">get_p4switch_id</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L968-L980"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_p4switch_id" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the ID of a P4 switch.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – P4 switch name in the topology</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">ID of P4 switch as a string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_p4switches">
<code class="descname">get_p4switches</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L313-L355"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_p4switches" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the P4 switches and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the switches configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by switch name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4switches</span><span class="p">())</span>
<span class="go">{&#39;s1&#39;:{&#39;isHost&#39;: False, &#39;isSwitch&#39;: True, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4switches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isSwitch&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: (False, True), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_p4switches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: False, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_p4switches_connected_to">
<code class="descname">get_p4switches_connected_to</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1023-L1034"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_p4switches_connected_to" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the P4 switches directly connected to a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of P4 switch names.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_routers">
<code class="descname">get_routers</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L445-L487"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_routers" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the routers and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the routers configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by router name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_routers</span><span class="p">())</span>
<span class="go">{&#39;r1&#39;:{&#39;isHost&#39;: False, &#39;isRouter&#39;: True, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_routers</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isRouter&#39;</span><span class="p">]))</span>
<span class="go">{&#39;r1&#39;: (False, True), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_routers</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;r1&#39;: False, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_routers_connected_to">
<code class="descname">get_routers_connected_to</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1036-L1047"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_routers_connected_to" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the routers directly connected to a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of routers.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_shortest_paths_between_nodes">
<code class="descname">get_shortest_paths_between_nodes</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1168-L1186"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_shortest_paths_between_nodes" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes all the shortest paths between <em>node1</em> and <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> – name of the starting node</li>
<li><strong>node2</strong> – name of the ending node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">list of paths.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Each path is given as a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></a> of node names from the first to the
last one.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_switches">
<code class="descname">get_switches</code><span class="sig-paren">(</span><em>fields=[]</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L269-L311"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_switches" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all the switches and their configuration parameters.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fields</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)"><em>list</em></a>) – optional list of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a> that specifies which
parameters need to be retrieved (and in which order)</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">all the switches configuration parameters if <code class="docutils literal"><span class="pre">fields</span></code> is empty, or
a dictionary of tuples, where the first one is indexed by switch name and
the second ones collect the values of the selected parameters in the exact
order they are placed in <code class="docutils literal"><span class="pre">fields</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.10)">dict</a></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If only one element is present in <code class="docutils literal"><span class="pre">fields</span></code>, then no tuple is created and
the value is directly put in the dictionary.</p>
</div>
<p class="rubric">Example</p>
<p>Let us consider the following example to clarify:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">topo</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="o">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_switches</span><span class="p">())</span>
<span class="go">{&#39;s1&#39;:{&#39;isHost&#39;: False, &#39;isSwitch&#39;: True, ...}, ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_switches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">,</span> <span class="s1">&#39;isSwitch&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: (False, True), ...}</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">topo</span><span class="o">.</span><span class="n">get_switches</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;isHost&#39;</span><span class="p">]))</span>
<span class="go">{&#39;s1&#39;: False, ...}</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_switches_connected_to">
<code class="descname">get_switches_connected_to</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1010-L1021"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_switches_connected_to" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets switches directly connected to a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of switch names.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.10)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_thrift_ip">
<code class="descname">get_thrift_ip</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L817-L832"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_thrift_ip" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4 switch’s IP where it listens for
incoming <em>Thrift</em> connections.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4 switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">IP to connect to.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.get_thrift_port">
<code class="descname">get_thrift_port</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L803-L815"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.get_thrift_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves the P4 switch’s <em>Thrift</em> port number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the P4 switch</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><em>Thrift</em> port to connect to.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.interface_to_node">
<code class="descname">interface_to_node</code><span class="sig-paren">(</span><em>node</em>, <em>intf</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1082-L1092"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.interface_to_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets name of the node’s neighbor attached to the specified interface.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>intf</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – interface name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">neighbor name.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.interface_to_port">
<code class="descname">interface_to_port</code><span class="sig-paren">(</span><em>node</em>, <em>intf</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1094-L1104"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.interface_to_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets port number of the the specified interface of a node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>intf</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – interface name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">port number.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isHost">
<code class="descname">isHost</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L554-L564"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isHost" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if a node is a host.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node is a host, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isIntf">
<code class="descname">isIntf</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L525-L539"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isIntf" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the interface between <em>node1</em> and <em>node2</em> exists.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>True</strong> if the interface exists, <strong>False</strong> otherwise.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isNode">
<code class="descname">isNode</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L502-L511"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the node exists.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node exists, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isP4RuntimeSwitch">
<code class="descname">isP4RuntimeSwitch</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L590-L600"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isP4RuntimeSwitch" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if a node is a P4Runtime switch.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node is a P4Runtime switch, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isP4Switch">
<code class="descname">isP4Switch</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L578-L588"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isP4Switch" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if a node is a P4 switch.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node is a P4 switch, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isRouter">
<code class="descname">isRouter</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L602-L612"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isRouter" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if a node is a router.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node is a router switch, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isSwitch">
<code class="descname">isSwitch</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L566-L576"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isSwitch" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if a node is a switch.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node is a switch, <strong>False</strong> otherwise.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.isType">
<code class="descname">isType</code><span class="sig-paren">(</span><em>name</em>, <em>node_type</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L614-L644"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.isType" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks custom node type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>node_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – type to check</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Possible <strong>node_type</strong> values are the following:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">host</span></code></li>
<li><code class="docutils literal"><span class="pre">switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4rtswitch</span></code></li>
<li><code class="docutils literal"><span class="pre">router</span></code></li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><strong>True</strong> if the node type matches with <code class="docutils literal"><span class="pre">node_type</span></code>,
<strong>False</strong> otherwise.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.10)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.keep_only_p4switches">
<code class="descname">keep_only_p4switches</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1213-L1215"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.keep_only_p4switches" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a networkx subgraph including only P4 switches.</p>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.keep_only_p4switches_and_hosts">
<code class="descname">keep_only_p4switches_and_hosts</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1217-L1219"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.keep_only_p4switches_and_hosts" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a networkx subgraph including only hosts and P4 switches.</p>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.keep_only_switches">
<code class="descname">keep_only_switches</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1209-L1211"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.keep_only_switches" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a networkx subgraph including only switches.</p>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_interface_bw">
<code class="descname">node_interface_bw</code><span class="sig-paren">(</span><em>node</em>, <em>intf</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L719-L735"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_interface_bw" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the bandwidth of a give node’s interface.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>intf</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – interface name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">bandwidth capacity of the interface in Mbps.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the bandwidth is unlimited, this method returns <code class="docutils literal"><span class="pre">-1</span></code>.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_interface_ip">
<code class="descname">node_interface_ip</code><span class="sig-paren">(</span><em>node</em>, <em>intf</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L703-L717"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_interface_ip" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the IP address a given node’s interface.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>intf</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – interface name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">IP address of the interface</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_to_node_interface_bw">
<code class="descname">node_to_node_interface_bw</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L684-L701"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_to_node_interface_bw" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the bandwidth of the interface of <em>node1</em> facing <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">bandwidth capacity of the interface in Mbps.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></p>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the bandwidth is unlimited, this method returns <code class="docutils literal"><span class="pre">-1</span></code>.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_to_node_interface_ip">
<code class="descname">node_to_node_interface_ip</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L670-L682"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_to_node_interface_ip" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the IP address and the subnet mask of the interface of
<em>node1</em> facing <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">IP / subnet mask of the interface.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_to_node_mac">
<code class="descname">node_to_node_mac</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1138-L1149"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_to_node_mac" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the MAC address of the interface of <em>node1</em> connected to <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">MAC address.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.node_to_node_port_num">
<code class="descname">node_to_node_port_num</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1125-L1136"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.node_to_node_port_num" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of the port of <em>node1</em> that is connected to <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">port number.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.port_to_node">
<code class="descname">port_to_node</code><span class="sig-paren">(</span><em>node</em>, <em>port</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1106-L1123"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.port_to_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the neighboring node  of <em>node</em> connected to <em>port</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>port</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)"><em>int</em></a>) – port number</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">neighbor node.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.set_node_color">
<code class="descname">set_node_color</code><span class="sig-paren">(</span><em>node</em>, <em>color</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1231-L1238"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.set_node_color" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets node’s color. Used when plotting the network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>shape</strong> – color to assign</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.set_node_shape">
<code class="descname">set_node_shape</code><span class="sig-paren">(</span><em>node</em>, <em>shape</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1222-L1229"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.set_node_shape" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets node’s shape. Used when plotting the network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node name</li>
<li><strong>shape</strong> – shape to assign</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.set_node_type_color">
<code class="descname">set_node_type_color</code><span class="sig-paren">(</span><em>node_type</em>, <em>color</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1259-L1276"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.set_node_type_color" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the color of the nodes filtered by type. Used when plotting the network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>node_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node type to select</li>
<li><strong>color</strong> – color to assign to nodes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Possible values for <strong>node_types</strong> are the following:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">host</span></code></li>
<li><code class="docutils literal"><span class="pre">switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4rtswitch</span></code></li>
<li><code class="docutils literal"><span class="pre">router</span></code></li>
</ul>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.set_node_type_shape">
<code class="descname">set_node_type_shape</code><span class="sig-paren">(</span><em>node_type</em>, <em>shape</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1240-L1257"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.set_node_type_shape" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the shape of the nodes filtered by type. Used when plotting the network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>node_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – node type to select</li>
<li><strong>shape</strong> – shape to assign to nodes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Possible values for <strong>node_types</strong> are the following:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">host</span></code></li>
<li><code class="docutils literal"><span class="pre">switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4switch</span></code></li>
<li><code class="docutils literal"><span class="pre">p4rtswitch</span></code></li>
<li><code class="docutils literal"><span class="pre">router</span></code></li>
</ul>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.subnet">
<code class="descname">subnet</code><span class="sig-paren">(</span><em>node1</em>, <em>node2</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L737-L751"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.subnet" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the subnet of the link between <em>node1</em> and <em>node2</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node1</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the first node</li>
<li><strong>node2</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)"><em>str</em></a>) – name of the second node</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the subnet in CIDR notation.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.10)">str</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="p4utils.utils.topology.NetworkGraph.total_number_of_paths">
<code class="descname">total_number_of_paths</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L1151-L1166"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NetworkGraph.total_number_of_paths" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the total number of shortest paths between all
host pairs in the network.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">number of paths.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.10)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="exception">
<dt id="p4utils.utils.topology.NodeDoesNotExist">
<em class="property">exception </em><code class="descclassname">p4utils.utils.topology.</code><code class="descname">NodeDoesNotExist</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/nsg-ethz/p4-utils/tree/master/p4utils/utils/topology.py#L25-L33"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#p4utils.utils.topology.NodeDoesNotExist" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.10)"><code class="xref py py-class docutils literal"><span class="pre">Exception</span></code></a></p>
<p>Exception raised when a node is not found.</p>
</dd></dl>

</div>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="p4utils.utils.thrift_API.html" class="btn btn-neutral float-left" title="p4utils.utils.thrift_API module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="p4utils.utils.traffic_utils.html" class="btn btn-neutral float-right" title="p4utils.utils.traffic_utils module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2021, Networked Systems Group (NSG@ETH).</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>